
#*--encoding:UTF-8--*

'''
整理数据
'''

from common.helper import Helper
from db.mysql import MysqlClient

class Arrangement( object ):

    def __init__(self):
        self.mysql = MysqlClient()
        self.name = "顺意e生百万医疗保险"

        # 拉取数据
    def pullData(self, data={}):
        for item in Helper.selectData(self.name, self.mysql):

            data["name"] = self.name
            data["company"] = "华安保险"
            data["year"] = item["year"]
            data["socialSec"] = "Y" if item["socialSec"]=="1" else "N"
            data["price"] = item["price"]
            data["expire"] = "1年"

            #判断
            # 尊享
            if item["programme"] == "P122903-T1":

                data["generalMedical"] = "300w"
                data["seriousMedical"] = "300w"
                data["annualTotal"] = "600w"

            # 优选
            elif item["programme"] == "P122903-T2":

                data["generalMedical"] = "200w"
                data["seriousMedical"] = "200w"
                data["annualTotal"] = "400w"

            # 经济
            else:

                data["generalMedical"] = "100w"
                data["seriousMedical"] = "100w"
                data["annualTotal"] = "200w"

            Helper.mergeTable(self.name, self.mysql, data)
